home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlib25 / close.c < prev    next >
C/C++ Source or Header  |  1990-09-28  |  418b  |  28 lines

  1. /*
  2.  * close(): close a file. written by Eric R. Smith and placed in the public
  3.  * domain
  4.  */
  5.  
  6. #include <osbind.h>
  7. #include <fcntl.h>
  8. #include <errno.h>
  9.  
  10. int
  11. close(fd)
  12.     int fd;
  13. {
  14.     int r;
  15.  
  16.     r = Fclose(fd);
  17.     if (r < 0) {
  18.         errno = -r;
  19.         return -1;
  20.     }
  21.     fd = __OPEN_INDEX(fd);
  22.     if (fd >= 0 && fd < __NHANDLES) {
  23.         __open_stat[fd].status = FH_UNKNOWN;
  24.         __open_stat[fd].flags = 0;
  25.     }
  26.     return 0;
  27. }
  28.